4
4
.
.
2
2
.
.
5
5
Z
Z
S
S
t
t
a
a
c
c
k
k
I
I
n
n
f
f
o
o
ZStack is Container View which organizes his child Views on top of each other.
ZStack Example shows how to use .offset to control how Views should overlap.
Parameters
NAME
DESCRIPTION
zIndex(0)
Modifier that can be applied to children to explicitly specify order unrelated to hierarchy (Double).
E
E
x
x
a
a
m
m
p
p
l
l
e
e
[
[
R
R
]
]
This example shows Text View on top of Image View.
ContentView.swift
struct ContentView: View {
var body: some View {
ZStack {
Image(systemName: "bubble.left")
.resizable()
.frame(width: 200.0, height: 200.0)
Text("Simple Swift Guide")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
View